<template>
	<c-base-page :current="2" :navText="'个人中心'">
		<view class="user-box">
			<view class="user-headers">
				<view class="user-header-side">
					<button class="bind-head" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
						<image :src="'/static/images/missing-face.png'" class="hear_img"></image>
					</button>
					<view class="header-info">
						<view class="header-nick">
							<view class="header-nick-title">昵称：</view>
							<input class="header-nick-input" type="nickname" :maxlength="20" :value="user.name" @input="onNickInput"
								@blur="onNickBlur" />
						</view>
						<view class="header-phones">
							<text class="phone">{{ phoneNumber || "授权手机号" }}</text>
							<button class="bind-phone" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
								<image src="/static/images/xiugaimima.png"></image>
							</button>
						</view>
					</view>
				</view>
			</view>
			<view class="user-lists">
				<uni-list :border="false">
					<uni-list-item  thumbSize="sm"
						title="通知中心" link to="/pages/notice/index" />
					<uni-list-item  thumbSize="sm"
						title="修改资料" link to="/pages/user/update" />
					<uni-list-item thumbSize="sm"
						title="关于我们" link to="/pages/user/aboutus" />
					<uni-list-item thumbSize="sm"
						title="退出登录" :showArrow="true" :clickable="true" @click="_logout()" />
				</uni-list>
			</view>
		</view>
		<view class="copy-right">Copyright©{{ appName }}  版权所有</view>
	</c-base-page>
</template>

<script>
	export default {
		data() {
			return {
				appName: "青华光伏",
				notLogin: true, //没有登陆
				user: {
					name: "ZSCN新能源"
				}, //用户信息
				phoneNumber: '13681875258' //用户手机号
			}
		},
		onLoad() {
			
		},
		methods: {
			_logout() {
				let that = this
				uni.showModal({
					title: '提示',
					content: `您确定要退出登录吗?`,
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							that.mxReLaunch("/pages/common/login/login")
						}
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background: #f6f6f6 !important;
	}
</style>
<style lang="scss" scoped>
	.user-box {
		width: 100%;
	}

	.user-headers {
		position: relative;
		margin: 40rpx 0 0;
		width: 92%;
		left: 4%;
		height: auto;
		padding: 20rpx 0;
		border-radius: 10rpx;
		background-image: linear-gradient(0deg, #20dad1, #1cbbb4);
		background-size: 100% 100%;
		.user-header-side {
			display: flex;
			align-items: center;
			padding: 20rpx 40rpx;
			position: relative;
		}
		.bind-head {
			flex: 1;
			width: 120rpx;
			height: 120rpx;
			max-width: 120rpx;
			padding: 0;
			margin: 0;
			background: none;
			border-radius: 50%;
		
			image {
				width: 100%;
				height: 100%;
				border-radius: 50%;
			}
		}
		
		.bind-head:active {
			background: rgba(255, 255, 255, 0.1);
		}
		.header-info {
			flex: 1;
			margin-left: 20rpx;
			color: #fff;
		
			.header-nick {
				display: flex;
				font-size: 28rpx;
				line-height: 60rpx;
				align-items: center;
				justify-content: flex-start;
			}
		
			.header-phones {
				display: flex;
				align-items: center;
		
				.phone {}
		
				.bind-phone {
					margin: 0 0 0 20rpx;
					padding: 0;
					line-height: 0;
					border-radius: 0;
					width: 40rpx;
					max-width: 40rpx;
					height: 40rpx;
					text-align: left;
					flex: 1;
					background: none;
		
					image {
						width: 100%;
						height: 100%;
					}
				}
			}
		}
	}

	/deep/ .user-lists {
		margin: 50rpx auto 0;
		padding: 20rpx 30rpx;
		width: calc(92% - 60rpx);
		background-color: #fff;
		border-radius: 6px;
		font-size: $uni-font-size-base;

		.uni-list-item__container {
			padding-left: 6px;
			padding-right: 0;
		}

		.uni-list-item__icon {
			margin-right: 0px !important;
		}

		.uni-list--sm {
			width: 36rpx;
			height: 36rpx;
		}

		.uni-icon-wrapper {
			padding: 0;
			padding-right: 2px;

			text {
				color: #cecece !important;
			}
		}
	}
	.copy-right {
		width: 100%;
		text-align: center;
		position: absolute;
		bottom: 50rpx;
		color: #999;
	}
</style>
